﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using HtmlAgilityPack;
using GeneCMS.Models.physical;
using BulletOnRails4NET.Models;
using Suteki.Common.Repositories;
using System.IO;

namespace GeneCMS.Models.logical
{
    public class ContentEdit
    {
        public int ID { get; set; }
        public int PageID { get; set; }
        public string ElementMatchCriteria { get; set; }
        public string AttributeToMatch { get; set; }
        public string Html { get; set; }
        public string Title { get; set; }

        public ContentEdit(Content db_content_obj)
        {
            ID = db_content_obj.ID;
            PageID = db_content_obj.PageID;
            ElementMatchCriteria = db_content_obj.ElementMatchCriteria;
            AttributeToMatch = db_content_obj.AttributeToMatch;
            Html = db_content_obj.Html;
            Title = db_content_obj.Title;
        }
    }

    public class PageEdit
    {
        public string Body { get; set; }

        //public static string GetFromPageID(int page_id)
        //{
        //    Repository<Page> pages_db = new Repository<Page>();
        //    Page page = pages_db.GetById(page_id);
        //    //Return the full page and inject the editying javascript pane
        //    //TODO inject the editing pane and js code
        //    return page.GeneratedHTML;
        //}

        public static string GetURLFromPageID(int page_id)
        {
            Repository<Page> pages_db = new Repository<Page>();
            Page page = pages_db.GetById(page_id);
            //Return the full page and inject the editying javascript pane
            //TODO inject the editing pane and js code
            
            
            return page.FullUrl;
        }

    }
}
